Merged heavily modified patch from maemo-gtk which enables opening and
authorMichael Natterer <mitch@imendio.com>
Fri, 27 Apr 2007 14:49:37 +0000 (14:49 +0000)
committerMichael Natterer <mitch@src.gnome.org>
Fri, 27 Apr 2007 14:49:37 +0000 (14:49 +0000)
commit533d3fcc76b39fc4c71afae9c2a31e8147851b8c
treee920ae1729522ef4580cca5134faa28bd64deb5e
parent069d78ed31fc1c0a9cb7621d27fe10d7b974315b
Merged heavily modified patch from maemo-gtk which enables opening and

2007-04-27  Michael Natterer  <mitch@imendio.com>

Merged heavily modified patch from maemo-gtk which enables opening
and closing submenus on click, and introduces some usability
changes when gtk-touchscreen-mode is enabled (bug #128968):

* gtk/gtkmenushell.c (struct GtkMenuShellPrivate): added boolean
"activated_submenu" to indicate that the current mouse operation
(click or drag) has opened a submenu.

(gtk_menu_shell_button_press): pop up submenus without delay
and record the fact in "activated_submenu".

(gtk_menu_shell_button_release): if a submenu was explicitely
opened, or not opened by this release's button_press, or enough
time has passed since timeout-opening it, close the submenu here.

(gtk_menu_shell_enter_notify): when entering a menu item with
any mouse button pressed, open its submenu.

(gtk_real_menu_shell_move_current): in touchsreen mode, close the
submenu when moving the focus away from it via keyboard-navigation.

* gtk/gtkmenuitem.[ch] (_gtk_menu_item_popup_submenu): added
parameter "gboolean with_delay" so GtkMenuShell can control this
for the different scenarios of submenu showing.

(_gtk_menu_item_popdown_submenu): new function. also needed by
GtkMenuShell for closing submenus on click.

Renamed internal function gtk_menu_item_select_timeout() to
gtk_menu_item_popup_timeout().

(gtk_menu_item_real_popup_submenu): new utility function which
does the actual popup and records the exact time of the popup when
the menu was timeout-opened (using g_get_current_time()).

(gtk_real_menu_item_select): don't add the popup timeout when in
touchscreen mode.

* gtk/gtkmenu.c (gtk_menu_popup): in touchscreen mode, select the
first item of every opened menu.

svn path=/trunk/; revision=17659
ChangeLog
gtk/gtkmenu.c
gtk/gtkmenuitem.c
gtk/gtkmenuitem.h
gtk/gtkmenushell.c